package com.antler.smt.portal.controller;

import com.antler.smt.entity.DictionaryEntity;
import com.antler.smt.portal.mapper.DictionaryInfoMapper;
import com.antler.smt.response.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @author vic
 * @date 2018-04-11 19:47
 *  
 */
@RestController
@RequestMapping(value = "/dictionary")
@Api(description = "字典接口")
public class DictionaryController {

    @Autowired
    DictionaryInfoMapper dictionaryInfoMapper;

    /**
     * 获取字典
     *
     * @param key
     * @return
     */
    @GetMapping("/getDictionary/{key}")
    @ApiOperation(value = "获取字典", httpMethod = "GET")
    public Result listArea(@PathVariable String key) {
        DictionaryEntity dictionaryEntity = dictionaryInfoMapper.selectByKey(key);
        return new Result(dictionaryEntity);
    }
}
